package com.kjj.basic.service.impl;

import com.kjj.basic.service.IFastDfsService;
import com.kjj.basic.util.FastdfsUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

@Service
public class FastDfsServiceImpl implements IFastDfsService {

    @Value("${fastdfs.url}")
    private String url;
    @Override
    public String upload(byte[] bytes, String extension) {
        return url+FastdfsUtil.upload(bytes,extension);
    }

    @Override
    public void delete(String path) {
        path = path.substring(url.length());
        FastdfsUtil.delete(path);
    }

}
